package org.example.Day8;

import java.io.IOException;
import java.util.Arrays;

public class Test5 {
    //字符集小结
    public static void main(String[] args) throws IOException {
        //编码
        String data = "a我b";
        byte[] bytes = data.getBytes();
        System.out.println(Arrays.toString(bytes));

        //按照字符集编码
        byte[] bytes1 = data.getBytes("GBK");
        System.out.println(Arrays.toString(bytes1));

        

        //解码
        String s1 = new String(bytes);
        System.out.println(s1);

        String s2 = new String(bytes);
        System.out.println(s2);
    }
}
